#include<stdio.h>
#include<string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

char str[] = "linux so easy!\n";
char buffer[1024];
int main()
{
    char* filename = "bite";
    int fd1 = open(filename,O_WRONLY | O_CREAT | O_TRUNC,0666);

    write(fd1,str,sizeof(str));
    close(fd1);

    fd1 = open(filename,O_RDONLY);
    int size = read(fd1,buffer,sizeof(buffer));
    printf("size:%d\n",size);
    printf("%s\n",buffer);

    lseek(fd1,6,SEEK_SET);
    size = read(fd1,buffer,sizeof(buffer));
    printf("size:%d\n",size);
    printf("%s\n",buffer);


    close(fd1);


    return 0;
}